package mysql

import "gorm.io/gorm"

type Goods struct {
	gorm.Model
	UserId     int     `json:"userId" gorm:"type:int(10);not null;comment:'用户编号'"`
	GoodsName  string  `json:"goodsName" gorm:"type:varchar(20);not null;comment:'商品名称'"`
	GoodsTitle string  `json:"goodsTitle" gorm:"type:varchar(50);not null;comment:'商品标题'"`
	GoodsPrice float64 `json:"goodsPrice" gorm:"type:float(10,2);not null;comment:'商品价格'"`
	GoodsStock int     `json:"goodsStock" gorm:"type:int(10);not null;comment:'商品库存'"`
	GoodsCover string  `json:"goodsCover" gorm:"type:varchar(200);not null;comment:'商品封面'"`
	GoodsIntro string  `json:"goodsIntro" gorm:"type:varchar(100);not null;comment:'商品简介'"`
}

func (g *Goods) Create() error {
	return DB.Debug().Model(&Goods{}).Create(&g).Error
}
